/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package system;

import java.awt.Desktop;
import java.net.URI;
import javax.swing.JOptionPane;
import sql.SQLHandler;

/**
 *
 * @author Micke
 */
public class Movie {

    private int movieID;
    private int yearOfRelease;
    private int runtime;
    private int budget;
    private String title;
    private String language;
    private String imgURL;
    private String genre;
    private String cast;
    private String author;
    private String director;
    private String producer;
    private String plot;
    private float grade;

    public Movie(int movieID, String title, int yearOfRelease, int runtime,
            int budget, String language, String genre, String cast,
            String author, String director, String producer, String imgURL, 
            String plot, float grade) {
        this.movieID = movieID;
        this.title = title;
        this.yearOfRelease = yearOfRelease;
        this.runtime = runtime;
        this.budget = budget;
        this.language = language;
        this.genre = genre;
        this.cast = cast;
        this.author = author;
        this.director = director;
        this.producer = producer;
        this.imgURL = imgURL;
        this.plot=plot;
        this.grade=grade;
        

    }

    public float getGrade() {
        return grade;
    }

    public String getPlot() {
        return plot;
    }

    public void searchOnYouTube() {
        Desktop desktop = Desktop.getDesktop();
        try {
            String searchTitle = title, modTitle = "";
            String[] searchs = searchTitle.split(" ");
            for (int i = 0; i < searchs.length; i++) {
                modTitle += searchs[i];
                modTitle += "+";
            }
            URI url = new URI("http://www.youtube.com/results?search_query=" + modTitle + "trailer");
            desktop.browse(url);
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, ex);
        }
    }

    public void searchImgOnGoogle() {
        Desktop desktop = Desktop.getDesktop();
        try {
            String searchTitle = title, modTitle = "";
            String[] searchs = searchTitle.split(" ");
            for (int i = 0; i < searchs.length; i++) {
                modTitle += searchs[i];
                if (i != searchs.length - 1) {
                    modTitle += "%20";
                }
            }
            URI url = new URI("http://www.google.se/images?hl=sv&q=" + modTitle);
            desktop.browse(url);
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, ex);
        }
    }

    /**
     * @return the movieID
     */
    public int getMovieID() {
        return movieID;
    }

    /**
     * @return the yearOfRelease
     */
    public int getYearOfRelease() {
        return yearOfRelease;
    }

    /**
     * @return the runtime
     */
    public int getRuntime() {
        return runtime;
    }

    /**
     * @return the budget
     */
    public int getBudget() {
        return budget;
    }

    /**
     * @return the language
     */
    public String getLanguage() {
        return language;
    }

    /**
     * @return the imgURL
     */
    public String getImgURL() {
        
        return imgURL;
    }

    /**
     * @return the genre
     */
    public String getGenre() {
        return genre;
    }

    /**
     * @return the cast
     */
    public String getCast() {
        return cast;
    }

    /**
     * @return the author
     */
    public String getAuthor() {
        return author;
    }

    /**
     * @return the director
     */
    public String getDirector() {
        return director;
    }

    /**
     * @return the producer
     */
    public String getProducer() {
        return producer;
    }

    public String getTitle() {
        return title;
    }
}
